<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <!--<link rel="shortcut icon" href="#" type="image/png">-->

    <title><%= title %></title>
<!--
    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet">-->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="mycss/style.css" rel="stylesheet">
    <link href="mycss/loginreg.css" rel="stylesheet">
    <link href="//at.alicdn.com/t/font_1472609699_243027.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body class="login-body">
    <div class="logreg-header">
      <div class="container w">
        <p class="login-log">登陆系统</p>
      </div>
    </div>
    <div class="login-con w container">
      <form action="" method="">
        <div class="login-wrap">
          <input type="text" id="username" name="username" placeholder="用户名" autofocus required>
          <input type="password" id="password" name="password" placeholder="密码" required>

          <button class="btn-login" id="login0" type="button">
            <i class="iconfont icon-yidenglu"></i>
          </button>
          <div class="log-checkbox">
            <label>
               <input type="checkbox" value="remember-me"> 记住当前用户
            </label>
            <span class="pull-right">
              <a data-toggle="modal" href="#myModal"> 忘记密码？</a>
            </span>
          </div>
          <div class="registration">
          </div>
        </div>
      </form>
    </div>

    <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title">忘记密码 ？</h4>
          </div>
          <div class="modal-body">
            <p>输入验证邮箱找回密码：</p>
            <input type="text" name="email" placeholder="邮箱" autocomplete="off" class="form-control placeholder-no-fix">

          </div>
          <div class="modal-footer">
            <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
            <button class="btn btn-primary" type="button">确认</button>
          </div>
        </div>
      </div>
    </div>

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>

    <script type="text/javascript">
      $(function(){
        $("#register0").click(function(){
          location.href = 'register';
        });
        $("#login0").click(function(){
          var username = $("#username").val();
          var password = $("#password").val();
          var data = {"uname":username,"upwd":password};
          $.ajax({
            url:'/login',
            type:'post',
            data: data,
            success: function(data,status){
              if(status == 'success'){
                console.log(status)
                location.href = 'home';
              }
            },
            error: function(data,status){
              if(status == 'error'){
                location.href = 'login';
              }
            }
          });
        });
      });

    </script>

  </body>
</html>
